bitkeeper revision 1.160.1.3 (3e93f829-ne467JH-6UdjBVdjZRCgw)
authorjws@cairnwell.research <jws@cairnwell.research>
Wed, 9 Apr 2003 10:38:33 +0000 (10:38 +0000)
committerjws@cairnwell.research <jws@cairnwell.research>
Wed, 9 Apr 2003 10:38:33 +0000 (10:38 +0000)
a few tricks to avoid memory problems.
BUG remains: there is nothing to stop the kernel stack growing too big (i.e. to nearly 8k); if it does, it will overwrite the idle0_task task struct which it shares a page with.
If you see a page fault in the scheduler (prev_task, next_task corrupted), suspect this bug.

xen/arch/i386/ioremap.c
xen/drivers/pci/pci.c

index 4ed7ba438d373ae175e8a7df2969d20fd70ca53e..717c69c9805752e27c19b2489dd3d04d358f5d9a 100644 (file)
@@ -50,6 +50,10 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag
     if (phys_addr >= 0xA0000 && last_addr < 0x100000)
         return phys_to_virt(phys_addr);
 
+    if(remap_base + size > IOREMAP_VIRT_END) {
+      printk("ioremap: going past end of reserved space!\n");
+      return NULL;
+    }
 #if 0
     /*
      * Don't allow anybody to remap normal RAM that we're using..
index 134e3e2c83cfcac155aad906810c3fe481bea566..87a64d7f82b53935593101060df25ba23bb8825c 100644 (file)
@@ -1505,21 +1505,26 @@ unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus)
 {
        unsigned int devfn, max, pass;
        struct list_head *ln;
-       struct pci_dev *dev, dev0;
+       struct pci_dev *dev, *dev0;
 
        DBG("Scanning bus %02x\n", bus->number);
        max = bus->secondary;
 
        /* Create a device template */
-       memset(&dev0, 0, sizeof(dev0));
-       dev0.bus = bus;
-       dev0.sysdata = bus->sysdata;
+       dev0 = kmalloc(sizeof(struct pci_dev), GFP_KERNEL);
+       if(!dev0) {
+         panic("Out of memory scanning PCI bus!\n");
+       }
+       memset(dev0, 0, sizeof(struct pci_dev));
+       dev0->bus = bus;
+       dev0->sysdata = bus->sysdata;
 
        /* Go find them, Rover! */
        for (devfn = 0; devfn < 0x100; devfn += 8) {
-               dev0.devfn = devfn;
-               pci_scan_slot(&dev0);
+               dev0->devfn = devfn;
+               pci_scan_slot(dev0);
        }
+       kfree(dev0);
 
        /*
         * After performing arch-dependent fixup of the bus, look behind